package com.example.cinema.bindingdata;

import android.view.View;
import android.widget.ImageView;

import androidx.databinding.BindingAdapter;
import androidx.databinding.ObservableField;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.cinema.R;

import java.util.List;

//消息实体类
public class UserMassgData {

    @BindingAdapter("msgimg")
    public static void setimgurl(View view,String url)
    {
        if(url!=null){
            RequestOptions options = new RequestOptions()
                    .placeholder(R.mipmap.defaut_img)
                    .error(R.mipmap.defaut_img)
                    .fallback(R.mipmap.defaut_img);
            Glide.with(view).load(url)
                    .apply(options)
                    .into((ImageView) view);
        }
    }

    public ObservableField<String> msgimg = new ObservableField<>();//消息头像
    public ObservableField<String> msgsend= new ObservableField<>();//消息发送者
    public ObservableField<List<String>> msgbrief= new ObservableField<>();//简略消息

}
